!function() {
    getApp();
    var e = require("../../../utils/http.js");
    Page({
        data: {
            systemBarHeight: 20,
            navigationBarHeight: 40,
            loginType: !0,
            priceIndex: 0,
            xy: !1,
            nickname: "张三",
            face: "../../static/image/face.png",
            vip: 0,
            vipDueTime: "",
            m1Original: 1,
            m6Original: 1,
            m12Original: 1,
            m1Price: 1,
            m6Price: 1,
            m12Price: 1,
            m1Ratio: 100,
            m6Ratio: 100,
            m12Ratio: 100,
            money: 1,
            vipContent: "您已经是VIP会员",
            novipContent: "您还不是VIP会员",
            policy: "/pages/index/index"
        },
        changePrice(e) {
            let t = e.currentTarget.dataset.cid, i = e.currentTarget.dataset.money;
            this.setData({
                priceIndex: t,
                money: i
            });
        },
        changeXy() {
            let e = this.data.xy;
            this.setData({
                xy: !e
            });
        },
        onLoad: function(e) {
            const t = decodeURIComponent(e.scene), i = decodeURIComponent(e.user_id);
            "undefined" != t && wx.setStorageSync("shareId", t), "undefined" != i && wx.setStorageSync("shareId", i);
            wx.getStorageSync("shareId");
            wx.getSystemInfo({
                success: e => {
                    this.system = e;
                }
            }), this.menu = wx.getMenuButtonBoundingClientRect(), this.systemBar = this.system.statusBarHeight, 
            this.navigationBar = 2 * (this.menu.top - this.system.statusBarHeight) + this.menu.height, 
            this.setData({
                systemBarHeight: this.systemBar,
                navigationBarHeight: this.navigationBar
            });
        },
        onReady: function() {},
        onShow: function() {
            var t = this, i = wx.getStorageSync("userId");
            i || (wx.showToast({
                title: "请先登陆",
                icon: "none"
            }), setTimeout(function() {
                wx.redirectTo({
                    url: "/pages/login/login"
                });
            }, 2e3)), i && (e.post("/app/exp/getvipinfo", {
                userId: i
            }, !1, function(e) {
                e && t.setData({
                    m1Original: e.m1_original,
                    m6Original: e.m6_original,
                    m12Original: e.m12_original,
                    m1Price: e.m1_price,
                    m6Price: e.m6_price,
                    m12Price: e.m12_price,
                    m1Ratio: e.m1_ratio,
                    m6Ratio: e.m6_ratio,
                    m12Ratio: e.m12_ratio,
                    vipContent: e.vip_content,
                    novipContent: e.novip_content,
                    policy: e.policy
                });
            }), e.post("/app/exp/getuserinfo", {
                userId: i
            }, !1, function(e) {
                e && t.setData({
                    nickname: e.nickname,
                    face: e.avatar,
                    vip: e.rank_id,
                    vipDueTime: e.vip_due_time
                });
            }));
        },
        onHide: function() {},
        onUnload: function() {},
        onPullDownRefresh: function() {},
        onReachBottom: function() {},
        onShareAppMessage: function() {},
        recharge: function() {
            if (!this.data.xy) return wx.showToast({
                title: "请同意协议后再开通"
            }), !1;
            var t = wx.getStorageSync("userId");
            e.post("/app/exp/recharge", {
                userId: t,
                scene: "vip",
                money: this.data.money,
                monthId: this.data.priceIndex,
                uid: t
            }, !1, function(e) {
                e && wx.requestPayment({
                    nonceStr: e.nonceStr,
                    package: e.package,
                    paySign: e.paySign,
                    timeStamp: e.timeStamp,
                    signType: e.signType,
                    success: e => {
                        wx.showToast({
                            title: "支付成功"
                        }), wx.switchTab({
                            url: "/pages/member/index/index"
                        });
                    },
                    fail: e => {
                        console.log("fail:" + JSON.stringify(e));
                    }
                });
            });
        },
        toIndex: function() {
            wx.navigateTo({
                url: "/subpages/pages/vip/index?scene=123"
            });
        }
    });
}();